<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Add Details</title>
<style type="text/css">
#menuDiv {
	position: absolute;
	width: 200px;
	height: 115px;
	z-index: 1;
	top: 0px;
	left: 0px;
}
#dataDiv {
	position: absolute;
	width: 720px;
	height: 115px;
	z-index: 2;
	left: 200px;
	top: 0px;
}
</style>
</head>

<body>

<script language="javascript" type="text/javascript">
<!-- 
//Browser Support Code
function submitFunction(){
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			document.form1.time.value = ajaxRequest.responseText;
		}
	}
	var f_name = document.getElementById('f_name').value;
	var l_name = document.getElementById('l_name').value;
	var mobile = document.getElementById('mobile').value;
	var address = document.getElementById('address').value;
	var phone = document.getElementById('phone').value;
	var queryString = "?f_name=" + f_name + "&l_name=" + l_name + "&mobile=" + mobile + "&address=" + address + "&phone=" + phone;
	ajaxRequest.open("GET", "storeDrData.php" + queryString, true);
	ajaxRequest.send(null); 
	alert('Data updated successfully');
}

//-->
</script>



<div id="dataDiv">

<?php
$dbhost = "localhost";
$dbuser = "root";
$dbpass = "";
$dbname = "erosheta";
	//Connect to MySQL Server
$con = mysql_connect($dbhost, $dbuser, $dbpass);
	//Select Database
mysql_select_db($dbname) or die(mysql_error());
$query = mysql_query("SELECT * FROM erosheta.dr_info WHERE dr_id = '1' ", $con);
while( $row = mysql_fetch_array($query) ){
	$f_name = $row['f_name'];
	$l_name = $row['l_name'];
	$mobile = $row['mobile'];
	$address = $row['address'];
	$phone = $row['phone'];
}

mysql_close($con);
?>

  <form id="form1" name="form1">
    <p>Please insert your data:</p>
    <table width="600" border="0">
      <tr>
        <td>First name: 
          <label for="f_name"></label>
        <input type="text" name="f_name" id="f_name" value="<?php echo $f_name?>"/></td>
        </tr>
        <tr>
        <td>Last name: 
          <label for="l_name"></label>
        <input type="text" name="l_name" id="l_name" value="<?php echo $l_name ?>"/></td>
        </tr>
        <tr>
        <td>Mobile number: 
          <label for="mobile"></label>
        <input type="text" name="mobile" id="mobile" value="<?php echo $mobile ?>"/></td>
      	</tr>
      <tr>
        <td>Clinic/Hospital address: 
          <label for="clinic_address"></label>
        <input type="text" name="address" id="address" value="<?php echo $address ?>"/></td>
        </tr>
        <tr>
        <td>Clinic/Hospital phone number: 
          <label for="phone_number"></label>
        <input type="text" name="phone" id="phone" value="<?php echo $phone ?>"/></td>
        </tr>
        <tr>
        <td><input type="button" name="submit" id="submit" value="Submit" onClick='submitFunction()'/></td>
      </tr>
    </table>
    <p>&nbsp;</p>
  </form>
</div>
<div id="menuDiv">
  <p><a href="../erosheta/createUser.php">Create new patient</a></p>
  <p><a href="../erosheta/viewUser.php">View patient history</a></p>
  <p><a href="addDetails.php">Add Dr information</a></p>
</div>
</body>
</html><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>

<body>
</body>
</html>